package com.pactera.madp.cp.controller.sidebar;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pactera.madp.common.core.util.R;
import com.pactera.madp.cp.api.dto.ContactRadarDto;
import com.pactera.madp.cp.api.vo.ContactRadarVO;
import com.pactera.madp.cp.api.vo.employee.SidebarMarkingDataTendencyVo;
import com.pactera.madp.cp.service.ManagerViewService;
import com.pactera.madp.cp.service.sync.MaRadarService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author huhao
 * @date 2022/5/17 14:54
 */
@RestController
@RequestMapping("/contact-radar")
@Api(value = "contact-radar", tags = "经理视图-客户雷达")
@RequiredArgsConstructor
public class ContactRadarSidebarController {

    private final MaRadarService radarService;
    private final ManagerViewService managerViewService;

    @GetMapping("/top3")
    @ApiOperation(value = "客户雷达首页top3数据")
    public R<List<ContactRadarVO>> top3(@RequestParam String wxUserId) {
        return R.ok(radarService.top3(wxUserId));
    }

    @GetMapping("/head")
    @ApiOperation(value = "客户雷达页首数据")
    public R<SidebarMarkingDataTendencyVo> head(@RequestParam String wxUserId, String date) {
        return R.ok(managerViewService.head(wxUserId, date));
    }

    @GetMapping("/page")
    @ApiOperation(value = "客户雷达分页")
    public R<IPage<ContactRadarVO>> pageResult(Page page, ContactRadarDto dto) {
        return R.ok(radarService.pageResult(page, dto));
    }

}
